# ifndef _LEMMATIZER_INTERFACE_H_
# define _LEMMATIZER_INTERFACE_H_

/**
  @file TurglemLemmatizer.h
  @brief Wrapper for russian and english turglem lemmatizer
*/

# include <turglem/lemmatizer.h>

# include <LemmatizerInterface.hpp>

/**
  @class TurglemLemmatizer TurglemLemmatizer.h <TurglemLemmatizer.h>
  @brief Wrapper for russian and english turglem lemmatizer
*/
class TurglemLemmatizer : public FTSS::LemmatizerInterface
{
public:
	/**	 
	  @brief A Constructor
	  @param pTurglemPath - path to the directory with russian and english dictionaries
	*/
    TurglemLemmatizer(CCHAR_P pTurglemPath);    
    
    /**
	  @brief A Destructor
	*/
    virtual ~TurglemLemmatizer() throw();
    
    /**
	  @brief Checks whether word might be lemmatized
	  @param sWord - word to check
	  @param iWordLength - length of word
	  @return 0 if this lemmatizer can handle this word, -1 - if not
	*/
    inline INT_32 CanLemmatize(CCHAR_P sWord, const UINT_32 & iWordLength) { return 0; }
    
    /**
	  @brief Get all firts forms of the word
	  @param sWord - word
	  @param iWordLength - length of word
	  @param iUseParadigms - use paradigms or not
	  @return Vector with all first forms of the word
	*/
    STLW::vector<STLW::string> FirstForms(CCHAR_P sWord, const UINT_32 & iWordLength, 
                                          const UINT_32 & iUseParadigms);
                                          
private:
	/**
	  @brief Get all firts forms of the word
	  @param sWord - word
	  @param iWordLength - length of word	  
	  @return 1 if word is russian, 0 - if not
	*/
    static inline UINT_32 IsRussian(CCHAR_P sWord, const UINT_32 & iWordLength)
    {
		for (UINT_32 i = 0; i < iWordLength; ++i)
		{
			if (!((sWord[i] >= 'a' && sWord[i] <= 'z') ||
				(sWord[i] >= 'A' && sWord[i] <= 'Z') ||
				(sWord[i] >= '0' && sWord[i] <= '9')))
			{
				return 1;
			}
		}
		
		return 0;
	}
        
private:
	/** Path to the dict_russian.auto */
    static CCHAR_P pRussianDictAutoPath;
    /** Path to the prediction_russian.auto" */
    static CCHAR_P pPredictionRussianAutoPath;
    /** Path to the paradigms_russian.bin */
    static CCHAR_P pParadigmsRussianBinPath;    
    /** Path to the dict_english.auto */
    static CCHAR_P pEnglishDictAutoPath;
    /** Path to the prediction_english.auto */
    static CCHAR_P pPredictionEnglishAutoPath;
    /** Path to the paradigms_english.bin */
    static CCHAR_P pParadigmsEnglishBinPath;
    
    /** Russian turglem lemmatizer */
    turglem oRusLem;
    /** English turglem lemmatizer */
    turglem oEngLem;
};

# endif //_LEMMATIZER_INTERFACE_H_
